import Vue from 'vue'
import VueRouter from 'vue-router'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component:()=>import("../views/Login/login.vue")
  },
  {
    path: '/home',
    name: 'home',
    component:()=>import("../views/Home/home.vue"),
	children:[
		{
			path:"/home/manager",
			name:"Manager",
			component: ()=>import("../views/manager/manager.vue")
		},
		{
			path:"/home/statistics",
			name:"statistics",
			component: ()=>import("../views/statistics/statistics.vue")
		},
		{
			path:"/home/classify",
			name:"classify",
			component: ()=>import("../views/classify/classify.vue")
		},
		{
			path:"/home/product",
			name:"product",
			component: ()=>import("../views/product/product.vue")
		}
	]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
